Day/Night/Peak Power Report

   

In general, in order to measure the day/night/peak power from the field, it is difficult to measure it until it is executed as a localmain program or a dedicated program on field instruments. Here, we will write a script in the AUTOBASE localmain program to represent the day/night/peak power.

Note: The script changes depending on which TYPE the power signal comes into the localmain program. (That is, the script formula changes depending on the TYPE, such as PULSE, the daily cumulative, the monthly cumulative, and the continuously accumulated value of power signals from the site.)

 

Here, we will write a script on the case of receiving a continuously accumulated power signal without RESET.

 

Assumption: The instrument sends the accumulated signal without RESET. (In other words, after operating the instrument, it continuously accumulates the amount of power without RESET and sends it to the localmain program, and the localmain program receives the amount of power and calculates it.)

         It is assumed to be late at night (00~07/22~23 hour), daytime (08~09/12~13/17~21 hour), and peak (10-11/14-16 hour).

 

1. Description of data storage structure

 

How to configure the localmain: Stores the amount of power coming from the instrument.

The AUTOBASE data structure stores data as 'average/maximum/minimum/accumulation/total accumulation.

Summarizing the amount of power by time will be stores as follows. Here, since we will use only the maximum value, we will not display data other than it.

 

Previous 23:00 (from 11 pm to 00 am)  average, 2000, minimum, accumulation, total accumulation

Current   00:00 (from 00 am to 01 am)  average, 2300, minimum, accumulation, total accumulation

Current   01:00 (from 01 am to 02 am)  average, 2500, minimum, accumulation, total accumulation

Current   02:00 (from 02 am to 03 am)  average, 2680, minimum, accumulation, total accumulation

Current   03:00 (from 03 am to 04 am)  average, 2900, minimum, accumulation, total accumulation

¡¦

¡¦

Current   23:00 (from 11 pm to 00 am)  average, 4500, minimum, accumulation, total accumulation

 

The storage values for the amount of power will be the same as above and accumulated from the measuring instrument, so the amount of power consumed during that time period is the current maximum value minus the previous value. (That is, it consumed at current 00:00 (from 00 am to 01 am) is 300 that is derived from (2300 - 2000).)

Therefore, the difference between the maximum values for each time of the actual amount of power may be calculated and stored at the corresponing time in each memory tag (Day: A0DW, Night: A0NW, Peak: A0PW). And, each amount of power storage memory does not perform RESET.

 

2. Storing the amount of night power

 

Script at program running as follows (the amount of power: analog input tag "A00KWH" (PLC_SCAN tag), it of night power: analog input tag "A0NW" (memory tag)).

 

year=@GetDateYear();                

mon=@GetDateMon();

day=@GetDateDay();

hour=@GetTimeHour();

min=@GetTimeMin();

 

if(hour>=9 && hour<=22) return;         // Night (00~07 / 22~23 hour), The 07:00 data storage time is from 08:00 to 08:10.

if( min !=12 && min !=13) return;         

if( min == 12 && flag ==1) return;         

if( min == 13 && flag ==0) return;         

 

if( min==12 && flag==0 ){                     // The storage point of the previous time data is between 0 and 10 minutes of the current time.

   @TimeMinusHour(year, mon, day, hour);    // Calculate leap year and total time and subtract 1 hour.

   data=@DataGetAiHour("$A00KWH", 4, year, mon, day, hour); 

   $A0NW=$A0NW+data;  

   @DataSetAiHour("A0NW",year,mon,day,hour,$A0NW,$A0NW,$A0NW,$A0NW);  

   flag=1;

  }

if( min==13 && flag==1 ) {

   flag=0;

  }

 

 

3 Storing the amount of daytime power

 

Script at program running as follows (the amount of power: analog input tag "A00KWH" (PLC_SCAN tag), it of daily power: analog input tag "A0DW" (memory tag)).

 

Day time (08~09 / 12~13 / 17~21 hour)

 

year=@GetDateYear();

mon=@GetDateMon();

day=@GetDateDay();

hour=@GetTimeHour();

min=@GetTimeMin();

sec=@GetTimeSec();

 

//Day time: 08~09 / 12~13 / 17~21 hour

if((hour>=0 && hour<=8) || (hour>=11 && hour<=12) || (hour>=15 && hour<=17) || hour==23) return;  

if( min !=12 && min !=13) return;

if( min == 12 && flag ==1) return;

if( min == 13 && flag ==0) return;

 

if( min==12 && flag==0 ){

   data=@DataGetAiHour("A00KWH", 4, year, mon, day, hour-1);

   $A0DW=$A0DW+data;

   @DataSetAiHour("A0DW",year,mon,day,hour-1,$A0DW,$A0DW,$A0DW,$A0DW);  

   flag=1;

  }

if( min==13 && flag==1 ) {

   flag=0;

  }

 

 

4. Storing the amount of peak power

 

Script at program running as follows (the amount of power: analog input tag "A00KWH" (PLC_SCAN tag), it of peak power: analog input tag "A0PW" (memory tag)).

 

Peak time (10~11 / 14~16 hour)

 

year=@GetDateYear();

mon=@GetDateMon();

day=@GetDateDay();

hour=@GetTimeHour();

min=@GetTimeMin();

sec=@GetTimeSec();

 

if((hour>=0 && hour<=10) || (hour>=13 && hour<=14) || (hour>=18 && hour<=23)) return;

if( min !=12 && min !=13) return;

if( min == 12 && flag ==1) return;

if( min == 13 && flag ==0) return;

 

if( min==12 && flag==0 ){

   data=@DataGetAiHour("$A00KWH", 4, year, mon, day, hour-1);

   $A0PW=$A0PW+data;  

   @DataSetAiHour("A0PW",year,mon,day,hour-1,$A0PW,$A0PW,$A0PW,$A0PW);  

   flag=1;

  }

if( min==13 && flag==1 ) {

   flag=0;

  }

 

 

After wring the script as above, mark the analog input tags A0DW (day), A0NW (night) and A0PW (peak) with "Save Data".

 

In the report, the amount of power per hour is divided by day/night/peak and written as follows to view at once.

 

<Figure 1> Example of configuring the daily report of the day/night/peak power

 

The daily report can be constructed as shown in <Figure 1>.

Time : =EtcMultiCount, Hour, 0, 23, 0, 0,                     (Multi Order 00 ~ 23 hour)

Total : =AiMultiSub, A00KWH, Hour, 0, 23, 0, 0,         (Ai Multi Sub 00~23 hour)

Night : =AiMultiSub, A0NW, Hour, 0, 23, 0, 0,             (Ai Multi Sub 00~23 hour)

Day   : =AiMultiSub, A0DW, Hour, 0, 23, 0, 0,             (Ai Multi Sub 00~23 hour)

Peak : =AiMultiSub, A0PW, Hour, 0, 23, 0, 0,             (Ai Multi Sub 00~23 hour)

 

 

<Figure 2> Example of configuring the monthly report of the day/night/peak power

 

The monthly report can be constructed as shown in <Figure 2>

Day   : =EtcMultiCount, Day, 1, 31, 0, 0,                      (Multi Order 01 ~ 31 day)

Total : =AIMultiSub, A00KWH, Day, 1, 31, 0, 0,         (Ai Multi Sub 01 ~ 31 day)

Night : =AIMultiSub, A0NW, Day, 1, 31, 0, 0,              (Ai Multi Sub 01 ~ 31 day)

Day   : =AIMultiSub, A0DW, Day, 1, 31, 0, 0,              (Ai Multi Sub 01 ~ 31 day)

Peak : =AIMultiSub, A0PW, Day, 1, 31, 0, 0,              (Ai Multi Sub 01 ~ 31 day)

 

Note: 'to MM/DD/HH' should be checked as shown in <Figure 3>

 

<Figure 3> Screen of data time